<template>
  <div id="app">
    <nav class="nav-tabs">
      <button 
        @click="currentView = 'component'" 
        :class="{ active: currentView === 'component' }"
        class="nav-tab"
      >
        组件演示
      </button>
      <button 
        @click="currentView = 'directive'" 
        :class="{ active: currentView === 'directive' }"
        class="nav-tab"
      >
        指令演示
      </button>
    </nav>
    
    <div class="content">
      <DragDemo v-if="currentView === 'component'" />
      <DirectiveDemo v-if="currentView === 'directive'" />
    </div>
  </div>
</template>

<script>
import { ref } from 'vue'
import DragDemo from './views/DragDemo.vue'
import DirectiveDemo from './views/DirectiveDemo.vue'

export default {
  name: 'App',
  components: {
    DragDemo,   
    DirectiveDemo
  },
  setup() {
    const currentView = ref('component')
    
    return {
      currentView
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', Arial, sans-serif;
}

#app {
  min-height: 100vh;
}

/* 导航标签样式 */
.nav-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 0 20px;
}

.nav-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  color: #6c757d;
  transition: all 0.3s ease;
}

.nav-tab:hover {
  color: #007bff;
  background: rgba(0, 123, 255, 0.1);
}

.nav-tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
  background: white;
}

.content {
  min-height: calc(100vh - 60px);
}
</style>
